package com.init.system.exception;


import com.init.system.common.result.ResultCode;

/**
 * 自定义异常类
 */
public class MyBusinessException extends RuntimeException {

    /**
     * 错误码
     */
    private final String code;

    public MyBusinessException(String code, String message) {
        super(message);
        this.code = code;
    }

    public MyBusinessException(ResultCode errorCode) {
        super(errorCode.getMsg());
        this.code = errorCode.getCode();
    }

    public MyBusinessException(ResultCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

    public String getCode() {
        return code;
    }
}
